package view;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JPanel;

import model.Set;

/**
 * Monitor2 panel
 * @author Adrien Ledeul
 * @version 0.1
 */
public class Monitor2Panel extends JPanel
{
	private static final long serialVersionUID = 1L;
	
	private MonitorPanel monitorPanel;
	private Set set;
	private JPanel centerPanel;
	private LogPanel treatedPanel;
	private LogPanel untreatedPanel;
	
	private String type;

	/**
	 * Constructors
	 * 
	 */
	public Monitor2Panel()
	{
		super();
		this.build();
	}
	
	public Monitor2Panel(MonitorPanel monitorPanel, String type)
	{
		super();
		this.monitorPanel = monitorPanel;
		this.set = monitorPanel.getSet();
		this.type = type;
		this.build();
	}

	/**
	 * Getters & Setters
	 * 
	 */
	public MonitorPanel getMonitorPanel()
	{
		return monitorPanel;
	}
	
	public Set getSet() 
	{
		return set;
	}

	public LogPanel getTreatedPanel() 
	{
		return treatedPanel;
	}

	public LogPanel getUntreatedPanel() 
	{
		return untreatedPanel;
	}


	/**
	 * Build the panel
	 */
	private void build()
	{
		this.setLayout(new BorderLayout());
				
		centerPanel = new JPanel();
		centerPanel.setLayout(new GridLayout(2,1));
		untreatedPanel = new LogPanel(this, type, false);
		treatedPanel = new LogPanel(this, type, true);
		centerPanel.add(untreatedPanel);
		centerPanel.add(treatedPanel);
		
		this.add(centerPanel, BorderLayout.CENTER);
	}
}
